<!DOCTYPE html>
<html lang="en" xmlns:th="http://www.thymeleaf.org">
<head>
    <link id="bootstrap-style" th:href="@{/css/bootstrap.min.css}" rel="stylesheet">
    <link th:href="@{/css/bootstrap-responsive.min.css}" rel="stylesheet">
    <link th:href="@{/css/common.css}" rel="stylesheet">
    <link id="base-style" th:href="@{/css/style.css}" rel="stylesheet">
    <!-- 月/日 日期选择 -->
    <link th:href="@{/css/default/easyui.css}" rel="stylesheet" type="text/css">
    <link th:href="@{/css/icon.css}" rel="stylesheet" type="text/css">
    <!-- 时间选择 -->
    <link th:href="@{/css/jquery-clockpicker.min.css}" rel="stylesheet" type="text/css">
    <link th:href="@{/css/bootstrap-clockpicker.min.css}" rel="stylesheet" type="text/css">

    <!-- start: Favicon -->
    <link rel="shortcut icon" th:href="@{img/favicon.ico}">
    <!-- end: Favicon -->

    <link rel="stylesheet" type="text/css" th:href="@{/js/elementui/theme-chalk/index.css}"/>

    <style>
        /* <!--  修改菜单栏离开后显示白色的问题  --> */

        .tempSelect{
            width: 270px;
            display: inline-block;
        }

        .ruleSelect{
            margin-top: 5px;
            margin-bottom: 5px;
        }

        .breadcrumb {
            height: 100%;
            margin: -20px -20px 20px -20px;
            line-height: 34px;
            background: #F7F7F7;
            border: 0px;
            color: #888;
            -webkit-box-shadow: none;
            -moz-box-shadow: none;
            box-shadow: none;
            -webkit-border-radius: 0px;
            -moz-border-radius: 0px;
            border-radius: 0px;
        }

        body {
            background: #1C2B36;
        }

        .row-fluid [class*="span"] {
            margin-left: 0px;
        }

        #title {
            font-family: "Microsoft YaHei", "Microsoft Sans Serif", "Microsoft SanSerf", 微软雅黑;
            font-size: 25px;
            font-weight: 800;
        }

        #content {
            width: 85.47%;
        }

        .neon-wrap {
            position: absolute;
            top: 20%;
            left: 50%;
            transform: translate(-50%, -50%);
            text-align: center;
        }

        .neon-wrap span {
            display: block;
        }

        .neon-text {
            font-family: 'Monoton', cursive;
            font-size: 100px;
            animation: neon 4s infinite;
        }

        .neon-by {
            color: #404040;
            text-shadow: -3px 0px 5px #404040, 0px 0px 2px #404040;
        }

        @keyframes neon {
            0%, 30%, 32%, 34% {
                color: #222;
                text-shadow: -3px 0px 5px #222, 0px 0px 2px #222;
            }
            31%, 33%, 35%, 100% {
                color: #404040;
                text-shadow: -3px 0px 5px #404040, 0px 0px 2px #404040;
            }
        }
    </style>
</head>
<body style="height: 750px;">
<!--删除提示模态框-->
<div class="modal fade" id="delcfmModel" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
    <div class="modal-dialog">
        <div class="modal-content">
            <div class="modal-header">
                <button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
                <h4 class="modal-title" id="myModalLabel">提示</h4>
            </div>
            <div class="modal-body">是否要删除？</div>
            <div class="modal-footer">
                <button type="button" class="btn btn-default" data-dismiss="modal">关闭</button>
                <button type="button" class="btn btn-primary" onclick="deleteProperty()">确定</button>
            </div>
        </div><!-- /.modal-content -->
    </div><!-- /.modal-dialog -->
</div>
<!--删除提示模态框结束-->
<div id="app">
    <div class="container-fluid-full">
    <div class="row-fluid">
        <noscript>
            <div class="alert alert-block span10">
                <h4 class="alert-heading">Warning!</h4>
                <p>You need to have <a href="" target="_blank">JavaScript</a> enabled to use this site.</p>
            </div>
        </noscript>

        <!-- start: Content -->
        <div id="content" class="span10" style="width: 100%">
            <ul class="breadcrumb" th:if="${#request.getParameter('breadcrumb') == 'true'}">
                <li>
                    <i class="fas fa-circle-notch"></i>
                    <a id="home" href="#" onclick="parent.location.reload()">主页</a>
                    <i class="icon-angle-right"></i>
                </li>
                <li><a href="#">图谱信息修改</a></li>
            </ul>
            <div class="row-fluid sortable">
                <div class="box span12">
                    <div class="box-header" data-original-title>
                        <h2><i class="halflings-icon white edit"></i><span class="break"></span>图谱信息修改</h2>
                    </div>
                    <div class="box-content">
                        <!--<form class="form-horizontal"  th:action="@{/device/addDevice}" method="post">-->
                        <form id="form1" class="form-horizontal">
                            <input type="hidden" id="graphId" name="graphId" th:value="${graphInfo.graphId}">
                            <fieldset>
                                <div class="control-group">
                                    <label class="control-label">图谱ID</label>
                                    <div class="controls">
                                        <span class="input-xlarge uneditable-input" th:value="${graphInfo.graphId}"
                                              th:text="${graphInfo.graphId}"></span>
                                    </div>
                                </div>
                                <div class="control-group">
                                    <label class="control-label">图谱名称</label>
                                    <div class="controls">
                                        <input class="input-xlarge focused" type="text" placeholder=""
                                               name="graphName" th:value="${graphInfo.graphName}" required="required"
                                               id="graphName">
                                        <div style="display: inline" id="checkName">
                                        </div>
                                        <span style="color:red;font-size: 20px">*</span>
                                    </div>
                                </div>
                                <div class="control-group">
                                    <label class="control-label">选择季节</label>
                                    <div class="controls">
                                        <select id="graph_type" class="select" name="graph_type">
                                            <option name="graph_type" th:selected="${graphInfo.graph_type == 1 || graphInfo.graph_type == null}" value="1">供冷季</option>
                                            <option name="graph_type" th:selected="${graphInfo.graph_type == 2}" value="2">过渡季</option>
                                            <option name="graph_type" th:selected="${graphInfo.graph_type == 3}" value="3">供热季</option>
                                        </select>
                                        <span style="color:red;font-size: 20px">*</span>
                                    </div>
                                </div>
                                <div class="control-group">
                                    <label class="control-label">图谱使用时间</label>
                                    <div class="controls">
                                        <input name="graphStartTime" id="timeStart" data-options="editable:true" type="text" class="easyui-datebox" required="required">
                                        <span>至</span>
                                        <input name="graphEndTime" id="timeEnd" data-options="editable:true" type="text" class="easyui-datebox" required="required">
                                        <span style="color:red;font-size: 20px">*</span>
                                    </div>
                                </div>
                                <div class="control-group">
                                    <label class="control-label">图谱工作时间</label>
                                    <div class="controls">
                                        <label class="control-label" style="width: 100px;">
                                            <span class="input-group clockpicker">
                                                <input name="startWorkTime" id="startWorkTime" style="width: 100px;" type="text"
                                                       class="form-control start-time" th:value="${graphInfo.startWorkTime}" >
                                                <span class="input-group-addon">
                                                    <span class="glyphicon glyphicon-time"></span>
                                                </span>
                                            </span>
                                        </label>
                                        <span style="position: relative;float: left;left: 25px;top: 10px;font-size: 14px;">至</span>
                                        <label class="control-label" style="width: 100px;margin-left: 35px">
                                            <span class="input-group clockpicker">
                                                <input name="endWorkTime" id="endWorkTime" style="width: 100px;" type="text"
                                                       class="form-control end-time" th:value="${graphInfo.endWorkTime}">
                                                <span class="input-group-addon">
                                                    <span class="glyphicon glyphicon-time"></span>
                                                </span>
                                            </span>
                                        </label>
                                        <span style="color:red;font-size: 20px;margin-left: 20px">*</span>
                                    </div>
                                </div>
                                <div class="control-group">
                                    <label class="control-label">室内温度点位:</label>
                                    <el-select v-model="stationData.indoorTempId" filterable size="medium" placeholder="请选择"
                                               style="margin-right: 30px!important;margin-left: 20px!important;" name="indoorTempIdSelect"
                                                @change="indoorTempIdChange">
                                        <el-option
                                                v-for="item in options"
                                                :key="item.value"
                                                :label="item.label"
                                                :value="item.value+''">
                                        </el-option>
                                    </el-select>
                                </div>
                                <div class="control-group">
                                    <label class="control-label">室内温度目标值</label>
                                    <div class="controls">
                                        <input class="input-xlarge focused" type="text" placeholder=""
                                               name="targetTemperature" th:value="${graphInfo.targetTemperature}" required="required"
                                               id="targetTemperature">
                                        <span style="color:red;font-size: 20px">*</span>
                                    </div>
                                </div>
                                <div class="control-group">
                                    <label class="control-label">策略类型:</label>
                                    <el-select v-model="stationData.strategyType" filterable size="medium" placeholder="请选择"
                                               style="margin-right: 30px!important;margin-left: 20px!important;" name="strategyTypeSelect"
                                               @change="strategyTypeChange">
                                        <el-option
                                                v-for="item in strategyTypeOptions"
                                                :key="item.value"
                                                :label="item.label"
                                                :value="item.value+''">
                                        </el-option>
                                    </el-select>
                                </div>
                                <div class="control-group">
                                    <label class="control-label">是否需要提前蓄能</label>
                                    <label style="margin-top: 6px;"class="radio"><input name="isSave" th:checked="${graphInfo.isSave eq 0}" type="radio" value="0">是</label>
                                    <label style="margin-top: 6px;"class="radio"><input name="isSave" th:checked="${graphInfo.isSave eq 1}" type="radio" value="1">否</label>
                                    <!-- <span style="color:red;font-size: 20px;margin-top: 6px;">*</span> -->
                                </div>
                                <div class="control-group">
                                    <label class="control-label">是否使用规则切换图谱</label>
                                    <label style="margin-top: 6px;" id="show" class="radio"><input name="useRule" th:checked="${graphInfo.useRule eq 1}" type="radio" value="1">是</label>
                                    <label style="margin-top: 6px;" id="notshow" class="radio"><input name="useRule" th:checked="${graphInfo.useRule eq 0}" type="radio" value="0">否</label>
                                    <span style="color:red;font-size: 20px;margin-top: 6px;">*</span>
                                </div>
                                <!-- 分割线 -->
<!--                                隐藏input保存是否使用规则切换图谱选项值等信息，方便js判断-->
                                <input id="hasRule" type="hidden" name="hasRule" th:value="${graphInfo.useRule}">
                                <input id="indoorTempId" type="hidden" name="indoorTempId" th:value="${graphInfo.indoorTempId}">
                                <input id="strategyType" type="hidden" name="strategyType" th:value="${graphInfo.strategyType}">

<!--                                <hr id="isShowLine" class="isShow" style="display: none" />-->
                                <div class="isShow control-group" style="display: none;">
                                    <div class="ruleSelect">
                                        <label class="control-label">开始规则</label>
                                        <div class="controls">
                                        室外温度连续<input id="startDayNum" name="startDayNum" style="width: 50px" type="number" th:value="${graphInfo.startDayNum}" min="2" max="5">天
                                        <div class="tempSelect">
                                            最
                                            <select class="select" id="startLevel" name="startLevel">
                                                <option name="startLevel" value="1" th:selected="${graphInfo.startLevel eq 1}">高</option>
                                                <option name="startLevel" value="2" th:selected="${graphInfo.startLevel eq 2}">低</option>
                                            </select>
                                            温
                                        </div>
                                        <select id="startRels" class="select" name="startRels">
                                            <option name="startRels" value="1" th:selected="${graphInfo.startRels eq 1}">大于</option>
                                            <option name="startRels" value="2" th:selected="${graphInfo.startRels eq 2}">小于</option>
                                            <option name="startRels" value="3" th:selected="${graphInfo.startRels eq 3}">等于</option>
                                        </select>
                                        <input id="startTem" name="startTem" style="width: 50px" type="number" th:value="${graphInfo.startTem}" min="-10" max="50">摄氏度
                                        <span style="color:red;font-size: 20px;margin-top: 6px;">*</span>
                                    </div>
                                    </div>
                                    <div class="ruleSelect">
                                        <label class="control-label"></label>
                                        <div class="controls">
                                        室内温度连续<input id="startDayNumIndoor" name="startDayNumIndoor"
                                                     th:value="${graphInfo.startDayNumIndoor}" style="width: 50px" type="number" min="2" max="5">天
<!--                                        空白，用于对齐-->
                                        <div class="tempSelect"></div>
                                        <select id="startRelsIndoor" class="select" name="startRelsIndoor">
                                            <option name="startRelsIndoor" value="1" th:selected="${graphInfo.startRelsIndoor eq 1}">大于</option>
                                            <option name="startRelsIndoor" value="2" th:selected="${graphInfo.startRelsIndoor eq 2}">小于</option>
                                            <option name="startRelsIndoor" value="3" th:selected="${graphInfo.startRelsIndoor eq 3}">等于</option>
                                        </select>
                                        <input id="startTemIndoor" name="startTemIndoor" th:value="${graphInfo.startTemIndoor}" style="width: 50px" type="number" min="-10" max="50">摄氏度
                                        <span style="color:red;font-size: 20px;margin-top: 6px;">*</span>
                                    </div>
                                    </div>
                                    <div class="ruleSelect">
                                        <label class="control-label">结束规则</label>
                                        <div class="controls">
                                        室外温度连续<input id="endDayNum" name="endDayNum" style="width: 50px" type="number" th:value="${graphInfo.endDayNum}" min="2" max="5">天
                                        <div class="tempSelect">
                                            最
                                            <select id="endLevel" class="select" name="endLevel">
                                                <option name="endLevel" value="1" th:selected="${graphInfo.endLevel eq 1}">高</option>
                                                <option name="endLevel" value="2" th:selected="${graphInfo.endLevel eq 2}">低</option>
                                            </select>
                                            温
                                        </div>
                                        <select id="endRels" class="select" name="endRels">
                                            <option name="endRels" value="1" th:selected="${graphInfo.endRels eq 1}">大于</option>
                                            <option name="endRels" value="2" th:selected="${graphInfo.endRels eq 2}">小于</option>
                                            <option name="endRels" value="3" th:selected="${graphInfo.endRels eq 3}">等于</option>
                                        </select>
                                        <input id="endTem" name="endTem" style="width: 50px" type="number" th:value="${graphInfo.endTem}" min="-10" max="50">摄氏度
                                        <span style="color:red;font-size: 20px;margin-top: 6px;">*</span>
                                    </div>
                                    </div>

                                    <div class="ruleSelect">
                                        <label class="control-label"></label>
                                        <div class="controls">
                                        室内温度连续<input id="endDayNumIndoor" name="endDayNumIndoor" style="width: 50px" type="number" th:value="${graphInfo.endDayNumIndoor}" min="2" max="5">天
                                        <div class="tempSelect"></div>
                                        <select id="endRelsIndoor" class="select" name="endRelsIndoor">
                                            <option name="endRelsIndoor" value="1" th:selected="${graphInfo.endRelsIndoor eq 1}">大于</option>
                                            <option name="endRelsIndoor" value="2" th:selected="${graphInfo.endRelsIndoor eq 2}">小于</option>
                                            <option name="endRelsIndoor" value="3" th:selected="${graphInfo.endRelsIndoor eq 3}">等于</option>
                                        </select>
                                        <input id="endTemIndoor" name="endTemIndoor" style="width: 50px" type="number" th:value="${graphInfo.endTemIndoor}" min="-10" max="50">摄氏度
                                        <span style="color:red;font-size: 20px;margin-top: 6px;">*</span>
                                    </div>
                                    </div>
                                </div>
                                <div class="form-actions">
                                    <button type="submit" class="btn btn-primary" onclick="editGraph();return false">提交</button>
                                    <button type="button" class="btn btn-primary" onclick="toDevice()">返回</button>
                                </div>
                            </fieldset>
                        </form>
                    </div>
                </div><!--/span-->
            </div><!--/row-->
        </div>
    </div>
</div>
</div>

<div class="clearfix"></div>

<div th:replace="main::common_js"></div>
<script th:inline="javascript" th:src="@{/js/vue.min.js}"></script>
<script th:src="@{/js/elementui/index.js}"></script>

<script>
    breadcrumb()
</script>

<script th:src="@{/js/detect-element-resize.js}"></script>
<script th:src="@{/js/iframe-resize.js}"></script>

<script type="text/javascript" th:inline="javascript">
    $('.clockpicker').clockpicker({placement: 'bottom', align: 'left', donetext: '选择'});
</script>

<script>
    var vm = new Vue({
        el: '#app',
        data: {
            stationData: {
                indoorTempId:'',
                strategyType:'',
            },
            options: [],
            strategyTypeOptions:[{
                label:'经济优先',
                value: 1001
            },{
                label:'节能优先',
                value: 1002
            },{
                label:'舒适优先',
                value: 1003
            },{
                label:'设备优先',
                value: 1004
            }]
        },
        created: function () {
            let that = this;
            that.getIndoorTempId();
            that.getCodeOptions();
            that.getStrategyType();
            // that.getStrategyTypeOptions();
        },
        mounted: function () {
            parent.modifyTitle('图谱信息修改')
        },
        methods: {
            getStrategyType:function () {
                let st = $("#strategyType").val();
                this.stationData.strategyType = st;
            },
            // getStrategyTypeOptions:function () {},
            strategyTypeChange:function () {
                $("#strategyType").val(this.stationData.strategyType);
                console.log("strategyType",$("#strategyType").val());
            },
            indoorTempIdChange:function () {
                $("#indoorTempId").val(this.stationData.indoorTempId);
                // console.log("indoorTempId",$("#indoorTempId").val());
            },
            getIndoorTempId:function () {
                let id = $("#indoorTempId").val();
                this.stationData.indoorTempId = id;
            },
            getCodeOptions:function () {
                let that = this;
                $.ajax({
                    type:'GET',
                    url:'/multipower/point/getAll',
                    success:function (data) {
                        if(data.status==1){
                            let res = [];
                            for(let i=0;i<data.data.length;i++){
                                res.push({
                                    value: data.data[i].id,
                                    label: data.data[i].pointName,
                                    code: data.data[i].devCode,
                                });
                            }
                            that.options = [...res];
                            console.log("options:",that.options);
                        }else{
                            layer.alert(data.msg, {
                                icon: 5,
                                title: "提示"
                            });
                        }
                    },
                    failure:function (data) {
                        layer.alert(data.msg, {
                            icon: 5,
                            title: "提示"
                        });
                    }
                })
            },
        }
    })
</script>

<script type="text/javascript" th:inline="javascript">
    var useRule = $("#hasRule").val();
    console.log("useRule:",useRule);
    if(useRule==1){
        let doms = document.getElementsByClassName("isShow")
        for (let i = 0; i<doms.length; i++) {
            doms[i].style.display = ''
        }
        document.getElementById("flag").value = "1"
    }else{
        let doms = document.getElementsByClassName("isShow")
        for (let i = 0; i<doms.length; i++) {
            doms[i].style.display = 'none'
        }
        document.getElementById("flag").value = "0"
    }
</script>

<script>
    //修改图谱的判断
    function editGraph() {
        var graphName = document.getElementById("graphName");//图谱名称
        var startTime = document.getElementById("timeStart");//开始使用时间
        var endTime = document.getElementById("timeEnd");//结束时间
        var targetTemperature = document.getElementById("targetTemperature");

        var flag = document.getElementById("hasRule");
        if (graphName.value == "") {
            window.parent.layerAlert('图谱名称不能为空', {
                icon: 5,
                title: "提示"
            });
            return false;
        }
        if (startTime.value == "") {
            window.parent.layerAlert('起始时间不能为空', {
                icon: 5,
                title: "提示"
            });
            return false;
        }
        if (endTime.value == "") {
            window.parent.layerAlert('终止时间不能为空', {
                icon: 5,
                title: "提示"
            });
            return false;
        }
        if (endTime.value == startTime.value) {
            window.parent.layerAlert('终止时间不能等于起始时间', {
                icon: 5,
                title: "提示"
            });
            return false;
        }

        if (startWorkTime.value == "") {
            window.parent.layerAlert('图谱开始工作时间不能为空', {
                icon: 5,
                title: "提示"
            });
            return false;
        }

        if (endWorkTime.value == "") {
            window.parent.layerAlert('图谱结束工作时间不能为空', {
                icon: 5,
                title: "提示"
            });
            return false;
        }

        if (startWorkTime.value >= endWorkTime.value) {
            window.parent.layerAlert('图谱开始工作时间不能大于或等于结束工作时间', {
                icon: 5,
                title: "提示"
            });
            return false;
        }

        if(targetTemperature.value == ""){
            window.parent.layerAlert('室内温度目标值不能为空', {
                icon: 5,
                title: "提示"
            });
            return false;
        }

        if (flag.value == 1) {
            let startDayNumber = document.getElementById("startDayNum");
            let startTem = document.getElementById("startTem");
            let endDayNumber = document.getElementById("endDayNum");
            let endTem = document.getElementById("endTem");

            let startDayNumberIn = document.getElementById("startDayNumIndoor");
            let startTemIn = document.getElementById("startTemIndoor");
            let endDayNumberIn = document.getElementById("endDayNumIndoor");
            let endTemIn = document.getElementById("endTemIndoor");

            if (startDayNumber.value == '') {
                window.parent.layerAlert('开始规则天数不能为空', {
                    icon: 5,
                    title: "提示"
                });
                return false;
            }

            if (startDayNumber.value < 2 || startDayNumber.value > 5) {
                window.parent.layerAlert('开始规则天数不能小于2或者大于5', {
                    icon: 5,
                    title: "提示"
                });
                return false;
            }

            if (startTem.value == '') {
                window.parent.layerAlert('开始规则摄氏度不能为空', {
                    icon: 5,
                    title: "提示"
                });
                return false;
            }

            if (startTem.value < -10 || startTem.value > 50) {
                window.parent.layerAlert('开始规则摄氏度不能小于-10或者大于50', {
                    icon: 5,
                    title: "提示"
                });
                return false;
            }

            if (endDayNumber.value == '') {
                window.parent.layerAlert('结束规则天数不能为空', {
                    icon: 5,
                    title: "提示"
                });
                return false;
            }

            if (endDayNumber.value < 2 || endDayNumber.value > 5) {
                window.parent.layerAlert('结束规则天数不能小于2或者大于5', {
                    icon: 5,
                    title: "提示"
                });
                return false;
            }

            if (endTem.value == '') {
                window.parent.layerAlert('结束规则摄氏度不能为空', {
                    icon: 5,
                    title: "提示"
                });
                return false;
            }

            if (endTem.value < -10 || endTem.value > 50) {
                window.parent.layerAlert('结束规则摄氏度不能小于-10或者大于50', {
                    icon: 5,
                    title: "提示"
                });
                return false;
            }

            if (startDayNumberIn.value == '') {
                window.parent.layerAlert('开始规则天数不能为空', {
                    icon: 5,
                    title: "提示"
                });
                return false;
            }

            if (startDayNumberIn.value < 2 || startDayNumberIn.value > 5) {
                window.parent.layerAlert('开始规则天数不能小于2或者大于5', {
                    icon: 5,
                    title: "提示"
                });
                return false;
            }

            if (startTemIn.value == '') {
                window.parent.layerAlert('开始规则摄氏度不能为空', {
                    icon: 5,
                    title: "提示"
                });
                return false;
            }

            if (startTemIn.value < -10 || startTemIn.value > 50) {
                window.parent.layerAlert('开始规则摄氏度不能小于-10或者大于50', {
                    icon: 5,
                    title: "提示"
                });
                return false;
            }

            if (endDayNumberIn.value == '') {
                window.parent.layerAlert('结束规则天数不能为空', {
                    icon: 5,
                    title: "提示"
                });
                return false;
            }

            if (endDayNumberIn.value < 2 || endDayNumberIn.value > 5) {
                window.parent.layerAlert('结束规则天数不能小于2或者大于5', {
                    icon: 5,
                    title: "提示"
                });
                return false;
            }

            if (endTemIn.value == '') {
                window.parent.layerAlert('结束规则摄氏度不能为空', {
                    icon: 5,
                    title: "提示"
                });
                return false;
            }

            if (endTemIn.value < -10 || endTemIn.value > 50) {
                window.parent.layerAlert('结束规则摄氏度不能小于-10或者大于50', {
                    icon: 5,
                    title: "提示"
                });
                return false;
            }
        }

        $.ajax({
            type: "get",
            url: "/multipower/graphInfo/checktime2",
            data: {
                "startTime": startTime.value,
                "endTime": endTime.value,
                "graphId": document.getElementById("graphId").value
            },
            success: function (data) {
                if (data.success) {
                    updateGraphInfo();
                } else {
                    window.parent.layerAlert("图谱时间不能重合", {
                        icon: 5,
                        title: "提示"
                    });
                }
            },
            error: function (err) {
                window.parent.layerAlert(err, {
                    icon: 5,
                    title: "提示"
                });
            }
        })

    }
    //修改逻辑
    function updateGraphInfo() {
        //提交修改接口
        $.ajax({
            type: "POST",
            dataType: "json",
            url: "/multipower/graphInfo/update",
            data: $("#form1").serialize(),
            success: function (data) {
                console.log("form1：",$("#form1").serialize());
                window.parent.layerAlert("修改成功", {
                    icon: 6,
                    title: "提示"
                });
                // window.location.href = "/multipower/graphInfo/viewGraphInfo";
            },
        })
    }

    document.getElementById("show").onclick = function() {
        let doms = document.getElementsByClassName("isShow")
        for (let i = 0; i<doms.length; i++) {
            doms[i].style.display = ''
        }
        document.getElementById("hasRule").value = 1
    }

    document.getElementById("notshow").onclick = function() {
        let doms = document.getElementsByClassName("isShow")
        for (let i = 0; i<doms.length; i++) {
            doms[i].style.display = 'none'
        }
        document.getElementById("hasRule").value = 0
    }
</script>
<script type="text/javascript">
    $(function(){

        function getUrlParam(id) {
            var regExp = new RegExp('([?]|&)' + id+ '=([^&]*)(&|$)');
            var result = window.location.href.match(regExp);
            if (result) {
                return decodeURIComponent(result[2]);
            } else {
                return null;
            }
        }

        $("#timeEnd").datebox({
            showSeconds: false,
            required:true,
            onShowPanel: function () {// 隐藏年的选择
                $(".calendar-prevyear").hide();
                $(".calendar-nextyear").hide();
                $(".calendar-menu-year-inner").hide();
            },
            formatter: function(date){
                if(date){
                    var m = date.getMonth()+1;
                    var d = date.getDate();
                    m = m<10?('0'+m):m;
                    d = d<10?('0'+d):d;
                    return m+'-'+d;
                }
            },
            parser: function (date) {
                if (!date) return new Date();
                var array = date.split(" ");// 分成日期和时间两部分
                var arrayDate = array[0].split("-");
                var monthStr = arrayDate[0];
                var dayStr = arrayDate[1];
                var month = parseInt(monthStr,10);// 月份
                var day = parseInt(dayStr,10);// 日
                if (month && day){
                    return new Date(new Date().getFullYear(),month-1,day,null,null,null);
                } else {
                    return new Date();
                }
            }
        });

        $("#timeEnd").datebox('setValue', getUrlParam('end'))

        $("#timeStart").datebox({
            showSeconds: false,
            required:true,
            onShowPanel: function () {// 隐藏年的选择
                $(".calendar-prevyear").hide();
                $(".calendar-nextyear").hide();
                $(".calendar-menu-year-inner").hide();
            },
            formatter: function(date){
                if(date){
                    var m = date.getMonth()+1;
                    var d = date.getDate();
                    m = m<10?('0'+m):m;
                    d = d<10?('0'+d):d;
                    return m+'-'+d;
                }
            },
            parser: function (date) {
                if (!date) return new Date();
                var array = date.split(" ");// 分成日期和时间两部分
                var arrayDate = array[0].split("-");
                var monthStr = arrayDate[0];
                var dayStr = arrayDate[1];
                var month = parseInt(monthStr,10);// 月份
                var day = parseInt(dayStr,10);// 日
                if (month && day){
                    return new Date(new Date().getFullYear(),month-1,day,null,null,null);
                } else {
                    return new Date();
                }
            }
        });

        $("#timeStart").datebox('setValue', getUrlParam('start'))

        var p1 = $("#timeEnd").datebox('panel'); //日期选择对象
        p1.find('span.calendar-text').on('DOMSubtreeModified',function(e){
            var text = $(e.target).html();
            var onlyMonth = text.split(' ');
            if(onlyMonth.length > 1){
                $(".calendar-text").html(onlyMonth[0]);// 不显示年份
            }
        });
        var p2 = $("#timeStart").datebox('panel');
        p2.find('span.calendar-text').on('DOMSubtreeModified',function(e){
            var text = $(e.target).html();
            var onlyMonth = text.split(' ');
            if(onlyMonth.length > 1){
                $(".calendar-text").html(onlyMonth[0]);// 不显示年份
            }
        });
    })
</script>
</body>
</html>
